package com.nd.teamfile.fileexplorer.sdk.type;

import java.io.Serializable;

import android.text.TextUtils;

import com.common.android.utils.parser.BaseType;


public class FileInfo implements BaseType, Serializable{
	//serialVersionUID:TODO（用一句话描述这个变量表示什么）
	private static final long serialVersionUID = 2730720939673831153L;
	public static final int STATE_UPLOAD_UNFINISHED_ERROR = 0;
	public static final int STATE_UPLOAD_FINISHED = 1;
	
	private int keyId;// 数据库主键
	private String id; // 文件id
	private String name; //  文件名
	private long gid; // 文件所属的组id
	private long createTime; // 创建时间
	private long size; // 文件大小
	private long createrUid; // 创建者的uid(uap)
	private String createUsername; // 创建者的名字
	private int state; // 文件的状态, STATE_UPLOAD_UNFINISHED,STATE_UPLOAD_FINISHED两种
	private String md5; // 文件的md5值
	private String sha1; // 文件的sha1值
	private String localCachePath; // 本地缓存地址
	private boolean isDowning; // 是否正在下载，用于本地控制
	private int currentUpLoadOrDownloadProgress; // 当前文件上传或者下载进度
	private String mFilepath;	//文件的路径，用于上传失败的情况下重新上传
	
	public FileInfo(){
		
	}
	
	public FileInfo(String name, int state) {
		this.name = name;
		this.state = state;
	}
	
	public int getKeyId() {
		return keyId;
	}
	public void setKeyId(int keyId) {
		this.keyId = keyId;
	}
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public long getGid() {
		return gid;
	}
	public void setGid(long gid) {
		this.gid = gid;
	}
	public long getCreateTime() {
		return createTime;
	}
	public void setCreateTime(long createTime) {
		this.createTime = createTime;
	}
	public long getSize() {
		return size;
	}
	public void setSize(long size) {
		this.size = size;
	}
	public long getCreaterUid() {
		return createrUid;
	}
	public void setCreaterUid(long createrUid) {
		this.createrUid = createrUid;
	}
	public String getCreateUsername() {
		return createUsername;
	}
	public void setCreateUsername(String createUsername) {
		this.createUsername = createUsername;
	}
	public int getState() {
		return state;
	}
	public void setState(int state) {
		this.state = state;
	}
	public String getMd5() {
		return md5;
	}
	public void setMd5(String md5) {
		this.md5 = md5;
	}
	public String getSha1() {
		return sha1;
	}
	public void setSha1(String sha1) {
		this.sha1 = sha1;
	}
	public String getLocalCachePath() {
		return localCachePath;
	}
	public void setLocalCachePath(String localCachePath) {
		this.localCachePath = localCachePath;
	}
	public boolean isDownloading() {
		return isDowning;
	}
	public void setDownloading(boolean isDowning) {
		this.isDowning = isDowning;
	}
	
	public boolean isDownloaded() { // 如果本地文件存在，就说明已经下载过了
		return !TextUtils.isEmpty(localCachePath);
	}
	public int getCurrentUpLoadOrDownloadProgress() {
		return currentUpLoadOrDownloadProgress;
	}
	public void setCurrentUpLoadOrDownloadProgress(
			int currentUpLoadOrDownloadProgress) {
		this.currentUpLoadOrDownloadProgress = currentUpLoadOrDownloadProgress;
	}
	
	public void setFilepath(String path){
		mFilepath=path;
	}
	
	public String getFilepath(){
		return mFilepath;
	}
}
